<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge">
    <meta name="viewport" content="user-scalable=no">
    <link rel="stylesheet" href="../../../railView/css/railbox.css" type="text/css" />
    <script type="text/javascript" src="../../../railView/js/railbox-2.0.0.js" charset="utf-8"></script>
    
    <style>
        #buttom-container {
            position: absolute;
            top: 4px;
            left: 45px;
            z-index: 99;
        }
        #buttom-container>.button {
            padding: 0 10px;
            min-width: 54px;
            height: 30px;
            line-height: 30px;
            margin: 4px;
            text-align: center;
            border-radius: 3px;
            border: none;
            cursor: pointer;
            background: rgba(34, 45, 50, 0.7);
            color: #FFFFFF;
        }
        #buttom-container>.button:hover {
            background: rgb(34, 45, 50);
        }
    </style>
</head>
<body>
    <div id="buttom-container">
        <button class="button" onclick="assemble()">模型装配</button>
    </div>
    <div id="left" style="width:100%;height:100%;position:relative;float:left"></div>
</body>
<script id="viewerStartup">
    var model;
    const modelIds = [
        '09cbfb23-7137-4340-add0-1afd962b1817', 
        'c49fcd26-6308-4b92-88b9-6c93ab4ef00d', 
        '56841689-3f81-47bd-9828-7534699459cc', 
        '251ca1d4-6d51-4ed9-b35a-0ac79bfba1c7',
        '9d814268-cc5d-4785-a63d-ffd67da61800'
    ]
    window.onload = function () {
        let proleft = new CarsView("left", 'csr', '660843fd-7475-4631-89cd-842dc2147c7b', callbackleft, {
            isShowAxis: true,
        });
        proleft.then(function (value) {
            model = value;
        });
    }
    function callbackleft(nodeNames, nodeIds, position, center, normal) {}
    function assemble () {
        model.assemblyModels(0, modelIds).forEach(item => {
            // 每个item为一个promise
            item.then(res => {
                // 每个promise解析后的值为当前装配模型的根节点id
                console.log(res, '每个promise解析后的值为当前装配模型的根节点id')
            })
        });
    }
</script>
</html>
